/*
 * @Author: fisher
 * @Date: 2024-02-06 10:20:06
 * @LastEditors: fisher luthor-li@qq.com
 * @LastEditTime: 2024-02-06 11:29:01
 * @FilePath: \allback\db.js
 * @Description:
 */
// db.js
const mongoose = require('mongoose')
/**
 * Connects to the MongoDB database.
 */
async function connectDB() {
  try {
    await mongoose.connect('mongodb://127.0.0.1:27017/pixelstream', {
      //   useNewUrlParser: true,
      //   useUnifiedTopology: true
    })
    console.log('MongoDB connected successfully')
  } catch (err) {
    console.error('Error connecting to MongoDB', err)
  }
}
module.exports = connectDB
